load("@fbcode//cpe/nupkg_builder:nupkg.bzl", "nupkg")
load("@fbcode//eden/fs:build_targets.bzl", "make_rpm_features")
load("@fbcode//registry:defs.bzl", "rpm")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")

oncall("scm_client_infra")

cpp_library(
    name = "config",
    headers = ["eden-config.h"],
    exported_deps = [
        "//common/base:build_info_values",
    ],
)

# TODO(T75318904): clean up the old packages once conveyor+slowroll is in
#                  place.
rpm.builder(
    name = "fb-eden-test",
    # We are setting up conveyor+slowroll after which we can much lower this
    # limit. A higher limit is required for now to avoid weekly breakages as in
    # S209761.
    autoclean_keep_versions = 200,
    buck_opts = rpm.buck_opts(
        config = {
            # split-dwarf is required for reduce binary size
            "fbcode.split-dwarf": "true",
        },
    ),
    configurations = [
        rpm.configuration(
            arch = "x86_64",
            os = "linux",
        ),
        rpm.configuration(
            arch = "aarch64",
            os = "linux",
        ),
        rpm.configuration(
            arch = "noarch",
            os = "mac",
            repo = "darwin/any",
        ),
    ],
    features = make_rpm_features(),
    summary = "Source control aware virtual filesystem",
)

nupkg.builder(
    name = "fb-eden-test-windows",
    compatible_with = [
        "ovr_config//os:windows",
    ],
    oncall = "scm_client_infra",
    shims = [
        {
            nupkg.shim.source: "fbcode//eden/fs/cli_rs/edenfsctl:edenfsctl",
            nupkg.shim.name: "eden",
        },
    ],
    summary = "Source control aware virtual filesystem",
    deps = [
        "fbcode//eden/fs/cli:edenfsctl",
        "fbcode//eden/fs/cli/trace:trace_stream",
        "fbcode//eden/fs/cli_rs/edenfsctl:edenfsctl",
        "fbcode//eden/fs/config/facebook:edenfs_config_manager",
        "fbcode//eden/fs/facebook:eden-fb303-collector",
        "fbcode//eden/fs/service:edenfs",
        "fbcode//eden/fs/service:edenfs[pdb]",
        # TODO: Figure out symbol package "//arvr/tools/translator:symbol_ents"
        # TODO: Set up install script to copy files to the appropriate locations
    ],
)

python_binary(
    name = "generate_version_release",
    main_src = "scripts/generate_version_release.py",
)
